home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / prodoc16.arc / PROLOG.DOC
Text File  |  1985-08-27  |  67KB  |  2,377 lines

  1.  
  2.          
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.                      A.D.A PROLOG Documentation Version 1.6
  29.                   for the Educational and Public Domain Versions
  30.  
  31.                                  August 26, 1985
  32.  
  33.               Copyright Robert Morein and Automata Design Associates
  34.  
  35.                                  1570 Arran Way
  36.                                Dresher, Pa. 19025
  37.  
  38.                                  (215)-646-4894
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.                                 Copyright Notice
  69.  
  70.  
  71.  
  72.              The  public domain PD PROLOG system has been contributed  to 
  73.         the  public domain for unrestricted use with one  exception:  the 
  74.         object  code  may not be  disassembled  or  modified.  Electronic 
  75.         bulletin  boards  and SIG groups are urged to aid in giving  this 
  76.         software the widest possible distribution.
  77.  
  78.              This documentation may be reproduced freely,  but it may not 
  79.         be  included in any other documentation without the permission of 
  80.         the author.
  81.  
  82.          
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.                                   Introduction
  135.                 
  136.              We  are  pleased to present the second major version  of  PD 
  137.         PROLOG, version 1.6. Version 1.6 fixes some significant bugs that 
  138.         were present in version 1.5. The memory requirements are somewhat 
  139.         greater  than  the original,  since it is uses the  large  memory 
  140.         model.  It compensates in thoroughness. The memory requirement is 
  141.         about  200K  bytes of TPA,  and it will benefit from up  to  240k 
  142.         bytes. The availalble workspace is 100K bytes.
  143.  
  144.  
  145.         We  hope  that you'll get some fun out of this  PROLOG.  It  will 
  146.         afford  you exposure to THE fifth generation language at the cost 
  147.         only  of  some  intellectual  effort.  The  motive  is  perfectly 
  148.         explicable:  We  want you to think of Automata Design  Associates 
  149.         for  fifth  generation  software.  It also gives us a  nice  warm 
  150.         feeling.
  151.              The  memory requirement is 200 k of transient program  area, 
  152.         plus  whatever  space is needed to execute programs  from  within 
  153.         PROLOG.  DOS  or  MSDOS 2.0 are required.  There are no  features 
  154.         requiring  IBM PC architecture.  The program benefits from up  to 
  155.         235k of transient program area.
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.                      Products by Automata Design Associates
  201.  
  202.              Automata  Design  Associates  specializes  in  software  for 
  203.         artificial  intelligence  and  robotic  applications.   A  PROLOG 
  204.         language  system is available in various configurations.  A  LISP  
  205.         interpreter will be introduced in March of 1985.
  206.  
  207.  
  208.              There  are five versions of PROLOG available  from  Automata 
  209.         Design  Associates.  All  of  them run under the MSDOS  or  PCDOS 
  210.         operating systems. Other environments will be supported soon.
  211.  
  212.  
  213.              .Public Domain PROLOG
  214.  
  215.         This  serves to further the general awareness of the public about 
  216.         PROLOG.  It  also is an excellent adjunct to anyone learning  the 
  217.         language.  Most  of  the core PROLOG described  by  Clocksin  and 
  218.         Mellish  in the book Programming In PROLOG is implemented.  Trace 
  219.         predicates  and  I/O  redirection  are  not.   
  220.  
  221.  
  222.              .Educational PROLOG
  223.  
  224.         At  extremely modest cost this affords an educational institution 
  225.         or  individual  a  PROLOG  system  which  provides  the   maximum 
  226.         available  programming  area  available  within  the  8086  small 
  227.         programming model.  Tracing,  a debugging aid,  allows monitoring 
  228.         a program as it runs.  User settable spy points selectively allow 
  229.         this.  Exhaustive  tracing  is also  available.  I/O  redirection 
  230.         gives some file ability.
  231.  
  232.              An  "exec"  function allows the execution of  a  program  or 
  233.         editor  from  within  PROLOG,  thus  encouraging  an  interactive 
  234.         environment.
  235.  
  236.              An  ESC menu is added,  permitting the control  of  tracing, 
  237.         toggling the printer, and screen printing.
  238.  
  239.              Definite clause grammar support is now included.
  240.              
  241.              The cost of Educational PROLOG is $29.95.
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.              .FSM PROLOG
  269.  
  270.              A  small  increment  in price adds full random  access  file 
  271.         capability. Character and structure I/O are allowed.
  272.              The  "asserta and "assertz" predicates are expanded and work 
  273.         with a clause indexing ability.  One can assert clauses  anywhere 
  274.         in the database under precise pattern matching control. 
  275.  
  276.              A tree structured lexical scoping system and floating  point 
  277.         arithmetic are other enhancements.
  278.  
  279.              The cost of FSM PROLOG is $49.95
  280.  
  281.  
  282.  
  283.              .VMI PROLOG -- Virtual Memory (Replaces type VMS)
  284.  
  285.  
  286.              At reasonable cost the addition of virtual memory gives  an 
  287.         expansion of capabilities of an order of magnitude. 
  288.  
  289.              The  database on disk is treated transparently.  No  special 
  290.         provisions  need  be  made  by the  user.  Virtual  and  resident 
  291.         databases  may be mixed.  A unique updating algorithim  preserves 
  292.         the format of the database as typed by the user while making only 
  293.         those changes necessary to make it equivalent to the database  in 
  294.         central memory.
  295.  
  296.              The cost of VMI PROLOG is $99.95
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.              .VML PROLOG Large model Virtual Memory System
  333.  
  334.              A.D.A.  PROLOG is a remarkable fifth generation developement 
  335.         tool  for  the  implementation  of  intelligent  strategies   and 
  336.         optimized  control.  It  is both the kernel for  applications  of 
  337.         virtually  unlimited scope and a sophisticated developement  tool 
  338.         that multiplies the productivity of the programmer many times. 
  339.  
  340.              With  a  cost/performance ratio exceeding that of any  other 
  341.         product  and  a  compatibility  insured  by  compliance  to   the 
  342.         Edinburgh syntax, performance is enhanced by numerous extensions, 
  343.         many of them invisible to the user.
  344.  
  345.              A quick overview of some of the features discloses:
  346.  
  347.              1) Invisible compilation to a semantic network preserves the 
  348.              flexibility  of  the  interpreted mode and the  speed  of  a 
  349.              compiler.
  350.                   The programmer can compile and recompile any portion of 
  351.              a  module at any time.  The edit/compile/test cycle is short 
  352.              and free of strain. An interface is provided to an editor of 
  353.              choice.
  354.  
  355.              2) Floating point arithmetic with a full complement of input 
  356.              and output methods, transcendental and conversion functions.
  357.  
  358.              3)  Virtual memory.  Module size and number is unrestricted. 
  359.              Resident and virtual modules may be coresident.  Compilation 
  360.              is incremental. The cache algorithim is sophisticated.
  361.                   Changes  made in the database can be updated to disk by 
  362.              a single command.
  363.  
  364.              4) A powerful exec function,  and acceptance of stream input 
  365.              make integration into applications practical.
  366.  
  367.              5) Many   additional  built-in  predicates   enhance   the 
  368.              efficiency of the system.
  369.  
  370.              6) Debugging facilities let you see your program run without 
  371.              any additional generation steps.
  372.  
  373.              7)  Totally  invisible and incremental  garbage  collection. 
  374.              There is NEVER any wait for this function.
  375.  
  376.         The  cost  of this system is $200 for the MSDOS version.
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.                                  Upgrade Policy
  399.  
  400.              Half  the  cost  of any A.D.A.  PROLOG  interpreter  may  be 
  401.         credited to the purchase of a higher level version.
  402.              The  full cost of VMS prolog may be applied to the  purchase 
  403.         of VMI or VML PROLOG.
  404.              Updates  to  a particular level product vary from $15.00  to 
  405.         $35.00.
  406.  
  407.  
  408.                                 Run-time Packages
  409.  
  410.              Software  developers wishing to integrate an A.D.A.  product 
  411.         into  their  system  should inquire  about  specialized  run-time 
  412.         packages available at reasonable cost.
  413.  
  414.  
  415.  
  416.                               Technical Information
  417.  
  418.              Technical information may be obtained at (215) - 646- 4894
  419.  
  420.              Perhaps we can answer the following questions in advance:
  421.  
  422.              There is no support for:  APPLE II, Atari, Commodore, or  
  423.         CPM 80 .  Other machines from these manufactures may be supported 
  424.         in the future.
  425.  
  426.              The   public   domain   version  is   available   from   the 
  427.         organizations  who distribute such software.  It is not available 
  428.         from us.
  429.              The MSDOS products are available on 5" and 8" diskettes.
  430.              
  431.  
  432.  
  433.  
  434.                               To Place Your Order:
  435.  
  436.              You may place your order at the following number:
  437.  
  438.                         (215)-646-4894   - day and night.
  439.  
  440.  
  441.  
  442.                                      Returns
  443.  
  444.              The  software may be returned within 30 days of purchase for 
  445.         a full refund.  This applies whether or not the software has been 
  446.         used.  We do ask that manuals, disks and packaging be returned in 
  447.         excellent condition.
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.                       How to run the Demonstration Programs 
  465.                         without Knowing What You're Doing
  466.  
  467.              We strongly advise that you purchase the book Programming in 
  468.         PROLOG by Clocksin and Mellish,  publisher Springer Verlag, 1981. 
  469.         For  the  impatient we give some advice.  Type the  demonstration 
  470.         program you wish to run.  There must be at least one entry  point 
  471.         within  the  program.  
  472.  
  473.         Note:  Please  understand that these are demonstrations programs. 
  474.         Regarding  user  interface,  they are poorly  written.  You  will 
  475.         probably have to read Clocksin and Mellish to appreciate that the 
  476.         following examples of input are not equivalent: "yes." , "yes" .
  477.  
  478.  
  479.         The animals program - "animal"
  480.          
  481.              Most  of the examples require C & M for  comprehension.  The 
  482.         program "animals", however, can be appreciated by anyone. It is a 
  483.         traditional   example of an expert system.
  484.              
  485.              We had hoped to include the animals program on disk,  but we 
  486.         have  found  to  our  dismay that the version which  we  used  is 
  487.         allegedly copyrighted by the implementors of PROLOG 86.  Don't be 
  488.         surprised - even "happy birthday" is copyrighted.  We will simply 
  489.         point out that the November '84 issue of Robotics Age included  a 
  490.         version  of  the  animals game,  which you can,  at the  risk  of 
  491.         copyright infringement,  type in.  There is only one change  that 
  492.         need  be  made.  The "concat" function used in that  program  has 
  493.         arguments of the form:
  494.  
  495.                       concat( [atom1, atom2,...], result ).
  496.  
  497.         In order to make the concat definition more closely resemble that 
  498.         of  "name",  which  is  described by Clocksin  and  Mellish,  the 
  499.         argments have been reversed:
  500.  
  501.                       concat( result, [atom1, atom2,...] )
  502.  
  503.         Assuming  that you have typed in the program and made the  change 
  504.         just noted, the following steps are required to run it:
  505.              
  506.              Run the prolog.exe file.  The prompt "?-" will appear.  Type 
  507.         "consult( 'animals' ).<CR>".  Here <CR> indicates you are to type 
  508.         a  carriage  return.  The PROLOG system will load  "animals"  and 
  509.         compile  it into an internal form.  When the "?-" prompt  appears 
  510.         PROLOG is ready to run the "animals" guessing game. The object of 
  511.         the program is to deduce the animal you are thinking of. To start 
  512.         it  off  type  "help.<CR>".  PROLOG  will  respond  by  asking  a 
  513.         question. 
  514.              Because of the way the animals program is written,  you must 
  515.         respond in a rigid format.  You may type "yes<CR>",  "no<CR>", or 
  516.         "why<CR>". 
  517.              Eventually the program will terminate with either a guess as 
  518.         to what animal you are thinking of,  or a remark that the  animal 
  519.         is  not within its domain of knowledge.  The program has learned, 
  520.         however.  You  may  run  the  program again to  see  what  effect 
  521.         additional knowledge has on the program's behavior. 
  522.  
  523.              The program fragment "console" shows how you may improve the 
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.         console input routines of any of these programs.
  531.              
  532.  
  533.         The Hematology Diagnosis Program - "hemat"
  534.  
  535.              Although  the  logical structure is not as sophisticated  as 
  536.         that of "animals", it is interesting for several reasons:
  537.  
  538.              1)  The  program  evaluates numerical data to  arrive  at  a 
  539.         diagnosis.
  540.  
  541.              2) Although inaccurate, it demonstrates that useful question 
  542.         answering systems are not difficult to write in PROLOG.
  543.  
  544.              3)  There  are  some mistakes in  the  program,  which  only 
  545.         slightly impede its usefulness. 
  546.  
  547.              This  program  uses  structure  input.  Terminate  all  your 
  548.         answers with a period, as in "y.<CR>", or "no.<CR>".
  549.         The starting point is "signs.<CR>".  PROLOG will prompt  you 
  550.         for  signs  of  anemia.  The  program attempts  to  diagnose  two 
  551.         varieties of a hemolytic anemia.
  552.              The program could use a good working over by a  hematologist 
  553.         and we would be delighted to collaborate.
  554.  
  555.  
  556.         Prime Number Generator - "sieve"
  557.  
  558.              This  program demonstrates that anything can be programed in 
  559.         PROLOG if one tries hard enough.  Asking the  question   
  560.           "primes( 50, L ).<CR>" causes a list of prime numbers less than 
  561.         50  to be printed out.  "Sieve" is heavily recursive and  quickly 
  562.         exhausts the stack space of the small model interpreters.
  563.  
  564.  
  565.         Grrules
  566.  
  567.              This  is  an  example  of the use  of  the  definite  clause 
  568.         grammer  notation.  PD  PROLOG  does not  have  this  translation 
  569.         facility,  but ED PROLOG and  all of our other versions do. It is 
  570.         possible  to  perform  the  translations  by  hand  if  you  have 
  571.         thoroughly  read  C  & M.  Then you would have  the  pleasure  of 
  572.         asking:
  573.  
  574.                  ?-sentence( X, [every,man,loves,a,woman], [] ).
  575.  
  576.         and  having the meaning elucidated as a statment in the predicate 
  577.         calculus.
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.                                Special Offer  # 1
  597.  
  598.              For  some  inexplicable reason,  demonstration programs  are 
  599.         hard to come by. We are too busy writing PROLOG fill this gap. We 
  600.         will  reward the contribution of "cute" sample programs with  the 
  601.         following:
  602.  
  603.              1) A free  copy of type VMS virtual memory PROLOG
  604.  
  605.              2) The sample program will be published as an intact file 
  606.              together with whatever comments or advertisments the author
  607.              may see fit to include, on our distribution disks. 
  608.  
  609.              3) Exceptional contributions may merit a copy of type VML 
  610.              large  model virtual memory PROLOG which now incorporates  a 
  611.              UNIX1 style tree structured domain system.
  612.  
  613.  
  614.                                 Special Offer # 2
  615.  
  616.  
  617.              If  you are a hardware manufacturer and would like a  PROLOG 
  618.         language  for your system,  the solution is simple.  Just send us 
  619.         one  of  your machines!  Provided your system  implements  a  "C" 
  620.         compiler, it will be ported in no time flat.
  621.  
  622.  
  623.         ______
  624.              1. Trademark of AT & T.
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.                          Writing Programs For ED PROLOG
  663.  
  664.              You do not type in programs at the "?-" prompt.  There is no 
  665.         built-in  editor.  The command "consult( user )" is accepted  but 
  666.         does not cause PROLOG to enter an editing mode.  We feel that the 
  667.         most universally acceptable editing method is for the user to use 
  668.         a text editor of choice,  which can be invoked from within PROLOG 
  669.         by the "exec" predicate.
  670.  
  671.              Use  Wordstar  or your customary editor to write a  program. 
  672.         Then  run  PD  PROLOG and use the consult function  to  load  the 
  673.         program.
  674.  
  675.              In  all  cases except PD PROLOG,  you can  run  your  editor 
  676.         without leaving PROLOG by use of the "exec" predicate.
  677.  
  678.  
  679.  
  680.                              Running the Interpreter
  681.  
  682.         COMMANDS: Give commands in lower case.
  683.  
  684.         TO RUN:
  685.              Invoke PROLOG.EXE. After the "?-" prompt appears,
  686.                type "consult( <filename><CR> )", where <filename> is the 
  687.                desired database.
  688.              To exit, type "exitsys.<CR>"
  689.  
  690.         TO ASK A QUESTION:
  691.              At the prompt, type "<expression>.<CR>", where 
  692.              <expression>  is  a  question as described by  Clocksin  and 
  693.              Mellish. Be sure to terminate the question with a period.
  694.              The question may be up to 500 characters long.
  695.  
  696.         TO INPUT A STRUCTURE AT THE KEYBOARD:
  697.              The structure may be up to 500 characters in length. Be sure 
  698.              to terminate with a period.
  699.  
  700.         TO ASK FOR ANOTHER SOLUTION:
  701.              If a solution has been provided, the PROLOG interpreter will 
  702.              ask  "More?  (Y/N):".  Only  if  a "y"  is  typed  will  the 
  703.              interpreter perform a search.
  704.  
  705.         TO ABORT A SEARCH:
  706.              Simply   type   the  escape  key.   The   interpreter   will      
  707.              respond  with  "Interrrupted.",  and return to  the  command      
  708.              prompt.
  709.  
  710.         TO LOAD ANOTHER DATABASE:
  711.              Type  "consult(<filename>).<CR>" The file name must have the 
  712.              extension  ".PRO".  It  is  not  necessary  to  include  the 
  713.              extension in the argument of consult. The file name as given 
  714.              must not be the same as a predicate name in the file or  any 
  715.              file which will be loaded.
  716.  
  717.         TO REMOVE A DATABASE:
  718.              Type "forget(<filename>).<CR>"
  719.  
  720.         TO EXIT TO THE OPERATING SYSTEM:
  721.              Type "exitsys.<CR>"
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.              The system is totally interactive; any commands the operator 
  730.         gives  are and must be valid program statements.  Statements must 
  731.         terminate with a period.      All commands which take a file name 
  732.         also  accept a path name.  Any name which is not a  valid  PROLOG 
  733.         atom (refer to C & M) must be enclosed in single quotes. Thus one 
  734.         could say
  735.  
  736.              consult( expert )
  737.  
  738.         but one would need single quotes with
  739.  
  740.              consult( 'b:\samples\subtype\expert' ).
  741.  
  742.  
  743.         To exit the system, type "exitsys.<CR>"
  744.  
  745.         Atoms  may contain MSDOS pathnames if they are enclosed by single 
  746.         quotes, ie.,  '\b:\samples\animal' .
  747.  
  748.         You may consult more than one file at a time.  However, all names 
  749.         are public and name conflicts must be avoided. The order in which 
  750.         modules are loaded may,  in cases of poor program design,  affect 
  751.         the behavior.
  752.  
  753.  
  754.  
  755.                              Command Line Arguments
  756.  
  757.              ED  PROLOG accepts one command line argument,  which is  the 
  758.         name  of  a "stream" which replaces the console  for  input.  The 
  759.         "stream"  in  MSDOS is a pipe or file which supplies input  until 
  760.         end-of-file is reached. Control then reverts back to the console. 
  761.         To avoid noisy parser error messages when end-of-file is reached, 
  762.         the last command in the file should be "see( user )."
  763.  
  764.  
  765.  
  766.                                A Reference of Note
  767.  
  768.  
  769.              With  minor  exceptions,  the syntax is a superset  of  that 
  770.         described  by  Clocksin and Mellish in the  book  Programming  in 
  771.         Prolog by W.F.  Clocksin and C.S.  Mellish, published by Springer 
  772.         Verlag in Berlin, Heidelberg, New York, and Tokyo. We shall refer 
  773.         to this book as "C & M".
  774.  
  775.  
  776.              There   are  very  few   syntactical   differences,   mostly 
  777.         unrecognized and/or minor.
  778.              When  an operator is declared using the "op" statement,  the 
  779.         operator must be enclosed in single quotes in the "op"  statement 
  780.         itself,  if  it would not otherwise be a legal Edinburgh functor. 
  781.         Subsequently,  however,  the parser will recognize it for what it 
  782.         is,  except  in  the "unop" statement,  where it  must  again  be 
  783.         enclosed in single quotes.
  784.  
  785.              Variable numbers of functor paramaters are supported.
  786.  
  787.              A  goal  may be represented by a  variable,  which  is  less 
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.         restrictive  than  the  C  &  M requirement  that  all  goals  be 
  795.         functors.  The  variable must be instantiated to a  functor  when 
  796.         that goal is pursued.
  797.  
  798.              Rules which appear inside other expressions must be enclosed 
  799.         in  parenthesis  if  the "," operator is to be  recognized  as  a 
  800.         logical connective.
  801.  
  802.              All  infix  operators described by C & M,  and user  defined 
  803.         infix,  prefix, and postfix operators with variable associativity 
  804.         and precedence are supported exactly as in C & M.
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.                          The Built In Predicate Library
  861.  
  862.                         Available Operators in PD and ED PROLOG
  863.  
  864.  
  865.         Column 1 gives the function symbol. 
  866.  
  867.         Column 2 gives the precedence. The range of precedence is 1 to 255.
  868.         A zero in the precedence column indicates the symbol is parsed as 
  869.         a functor, and precedence is meaningless in this case.
  870.  
  871.         Column 3 gives the associativity. 
  872.         A zero in the associativity column indicates the symbol is parsed
  873.         as a functor, and associativity is meaningless in this case.
  874.  
  875.         Column 4 indicates which version the function is available in. 
  876.         Unless otherwise noted, the function is available in all versions.
  877.         Nonstandard predicates are indicated by "NS".
  878.  
  879.  
  880.         op/pred      precedence    associativity         availability
  881.  
  882.         "!"             0             0
  883.         "|"             0             0
  884.         "="             40,           XFX                   
  885.         "=="            40,           XFX                   
  886.         "\\="           40,           XFX                   
  887.         "\\=="          40,           XFX       
  888.         "/"             21,           YFX       
  889.         "@="            40,           XFX       
  890.         ">="            40,           XFX       
  891.         "=<"            40,           XFX       
  892.         ">"             40,           XFX       
  893.         "<"             40,           XFX       
  894.         "-"             31,           YFX        
  895.         "*"             21,           YFX
  896.         "+"             31,           YFX
  897.         "=.."           40,           XFX
  898.         "-->"           255,          YFY       (not  in  PD PROLOG)
  899.         "?-"            255,          FY  
  900.               
  901.  
  902.  
  903.         "arg"           0,            0,                                   
  904.         "asserta"       0,            0,                                   
  905.         "assertz"       0,            0,                                   
  906.         "atom"          0,            0,                                   
  907.         "atomic"        0,            0,                                   
  908.         "clause"        0,            0,                                   
  909.         "clearops"      0,            0,                                   
  910.         "concat"        0,            0,                                   
  911.         "consult"       8,            FX,                                  
  912.         "debugging      0,            0,                                   
  913.         "dir"           0,            0,                                   
  914.         "display"       0,            0,                                   
  915.         "exec"          0,            0,                                   
  916.         "exitsys"       0,            0,                                   
  917.         "forget"        0,            0,                                   
  918.         "functor"       0,            0,                                   
  919.         "get0"          8,            FX,                                  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.         "integer"       0,            0,                                   
  927.         "is"            40,           XFX,                                 
  928.         "listing"       0,            0,                                   
  929.         "mod"           11,           XFX,                                 
  930.         "name"          0,            0,                                   
  931.         "nl"            0,            0,                                   
  932.         "nodebug"       0,            0,       (not in PD PROLOG)
  933.         "nonvar"        0,            0,                                   
  934.         "nospy"         50,           FX,      (not in PD PROLOG)
  935.         "not"           60            FX                                   
  936.         "notrace"       0,            0,       (not in PD PROLOG)
  937.         "op"            0,            0,                                   
  938.         "popoff"        0,            0,       NS
  939.         "popoffd"       0,            0,       NS
  940.         "popon"         0,            0,       NS
  941.         "popond"        0,            0,       NS
  942.         "print"         0,            0,                                   
  943.         "put"           0,            0,                                   
  944.         "ratom"         0,            0,                                   
  945.         "read"          0,            0,                                   
  946.         "recon"         0,            0,                                   
  947.         "repeat"        0,            0,                                   
  948.         "retract"       0,            0                                    
  949.         "rnum"          0,            0,                                   
  950.         "see"           0,            0,       (not in PD PROLOG)
  951.         "seeing"        0,            0,       (not in PD PROLOG)
  952.         "seen"          0,            0,       (not in PD PROLOG)
  953.         "skip"          0,            0,       (not in PD PROLOG)
  954.         "spy"           50,           FX,      (not in PD PROLOG)
  955.         "tab"           0,            0,                                   
  956.         "tell"          0,            0,       (not in PD PROLOG)
  957.         "telling"       0,            0,       (not in PD PROLOG)
  958.         "told"          0,            0,       (not in PD PROLOG)
  959.         "trace"         0,            0,       (not in PD PROLOG)
  960.         "true"          0,            0,                                   
  961.         "unop"          0,            0,                                   
  962.         "var"           0,            0,                                   
  963.         "write"         0,            0,                                   
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.                         Description of the Modifications.
  993.              
  994.  
  995.         call( <goal> )
  996.  
  997.              The  predicate as defined in C & M is obsolete.  The purpose 
  998.         was  to permit a goal search where the goal name was  a  variable 
  999.         instantiated  to  some functor name.  A.D.A.  permits writing  of 
  1000.         goals with such names,  so the mediation of the "call" clause  is 
  1001.         no longer necessary.
  1002.  
  1003.              The  "call"  predicate  may  be  trivially  implemented  for 
  1004.         compatibility with the PROLOG definition
  1005.  
  1006.                                  call( X ) :- X.
  1007.  
  1008.  
  1009.  
  1010.         clause
  1011.  
  1012.              The  function  clause(  X,  Y ) has the  new  optional  form 
  1013.         clause(  X,  Y,  I  ).  If the third variable is written,  it  is 
  1014.         instantiated  to the current address of a clause in  memory.  The 
  1015.         only  use of the result is with succeeding assertfa and  assertfz 
  1016.         statements.
  1017.  
  1018.  
  1019.         debugging
  1020.  
  1021.              "Debugging"  prints a list of the current  spypoints.  After 
  1022.         each name a sequence of numbers may appear, indicating the number 
  1023.         of  arguments that is a condition of the trace.  The  word  "all" 
  1024.         appears  if  the  number of arguments is not a condition  of  the 
  1025.         trace.
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.         op( <prec>, <assoc>, <functor> )
  1059.  
  1060.              Defines  the  user  definable  grammar  of  a  functor.  The 
  1061.         definition conforms to that in C & M. We mention here a minor but 
  1062.         important point.  If <functor> is not a valid PROLOG atom it must 
  1063.         be   enclosed  in  single  quotes  when  declared  in  the   "op" 
  1064.         declaration and when undeclared in the "unop" declaration.  It is 
  1065.         not  necessary  or legal to do this when the functor is  actually 
  1066.         being used as an operator.
  1067.  
  1068.              Declared  operators  are annotated in the directory  display 
  1069.         with their precedence and associativity.
  1070.  
  1071.  
  1072.         Output predicates
  1073.  
  1074.            display
  1075.            write
  1076.            print
  1077.            put
  1078.  
  1079.              These  functions  have  been  modified  to  accept  multiple 
  1080.         arguments in the form:
  1081.  
  1082.                        print( <arg1>, <arg2>, <arg3>,... )
  1083.  
  1084.         Thus, "put( a, b, c )" would result in the display of "abc".
  1085.              The  names  of  some  PROLOG atoms that may  occur  are  not 
  1086.         accepted  by  the  PROLOG scanner  unless  surrounded  by  single 
  1087.         quotes.  This only applies when such an atom is read in, not when 
  1088.         it is internally generated. Nevertheless, this presents us with a 
  1089.         problem:  We  would  like to be capable of writing  valid  PROLOG 
  1090.         terms to a file. In some cases, it is necessary to add the single 
  1091.         quotes.  In other cases,  such as human oriented output, they are 
  1092.         an irritant. The modified definitions of the following predicates 
  1093.         are an attempt at a solution:
  1094.  
  1095.              display
  1096.              Operator  precedence  is ignored,  all functors are  printed 
  1097.              prefix and single quotes are printed if needed or they  were 
  1098.              supplied if and when the atom was originally input.
  1099.  
  1100.              write
  1101.              Operator  precedence is taken into account and operators are 
  1102.              printed according to precedence.  Single quotes are  printed 
  1103.              under the same conditions as for "display."
  1104.  
  1105.              print
  1106.              Operator  precedence is taken into account and operators are 
  1107.              printed  according to precedence.  Single quotes  are  never 
  1108.              displayed.  This  is  a  human oriented form of  output  and 
  1109.              should  never  be used for writing of terms for  the  PROLOG 
  1110.              scanner.
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.         get0
  1125.         read
  1126.  
  1127.              The  functions  "get0"  and "read"  have  been  extended  to 
  1128.         support input from a stream other than the one currently selected 
  1129.         by "see". To direct output to a file or other stream, an optional 
  1130.         argument  is used.  For example,  "get0( char,  <file name> )" or 
  1131.         "get0( char,  user )" would cause input to come from <file  name> 
  1132.         or the console.  If the file has not already been opened,  "get0" 
  1133.         will fail.
  1134.  
  1135.  
  1136.  
  1137.              Atoms enclosed by single quotest, eg. '\nthis is a new line' 
  1138.         can contain the escape sequences
  1139.  
  1140.              '\n', '\r', '\t' and '\''.
  1141.  
  1142.              If these atoms are printed by "display" or "write" they  are 
  1143.         printed  just  as they are.  If they are printed by  the  "print" 
  1144.         clause they are translated as follows:
  1145.  
  1146.         '\n'  results  in  the printing of a carriage return and  a  line 
  1147.         feed.
  1148.         '\r' results in the printing of a carriage return only.
  1149.         '\t' results in the printing of a tab character.
  1150.         '\'' allows the printing of a single quote within a quoted atom.
  1151.  
  1152.              The "portray" feature is not presently implemented.
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.                         Description of the New Predicates
  1191.  
  1192.  
  1193.         clearops-
  1194.              Nullify  the  operator  status  of  every  operator  in  the 
  1195.              database.
  1196.  
  1197.         concat( (<variable> | <functor>), <List> )
  1198.              A  list  of functors or operators is concatenated  into  one 
  1199.         string,  which becomes the name of a new atom to which <variable> 
  1200.         or <functor> must match or be instantiated.
  1201.  
  1202.  
  1203.         dir( option )
  1204.              Provide  an  alphabetized listing to the console  of  atoms, 
  1205.         constants,   or   open  files.   Without  options,   simply  type 
  1206.         "dir.<CR>". Options are:
  1207.  
  1208.              dir( pred ) - list clause names only.
  1209.              dir( files ) - list open files only.
  1210.  
  1211.  
  1212.         exitsys
  1213.              Exit to the operating system.
  1214.  
  1215.         forget( <file name> )
  1216.              Make  a database unavailable for use and reclaim the storage 
  1217.         it occupied.
  1218.  
  1219.  
  1220.         ratom( <arg>, <stream> )-
  1221.              Read an atom from the input stream,  to which <arg>  matches 
  1222.         or  is  instantiated.  <stream> is optional.  If <stream> is  not 
  1223.         given, the input stream defaults to the standar input.
  1224.              Input is terminated by a CR or LF, which are not included in 
  1225.         the stream.
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.                              Arithmetic Capabilities
  1257.  
  1258.              Integer  arithmetic is supported.  Numbers are 32 bit signed 
  1259.         quantities. The following arithmetic operators are supported:
  1260.  
  1261.                       "+", "-", "*", "/", <, <=, >, >=, mod.
  1262.  
  1263.         Arithmetic operators must never be used as goals,  although  they 
  1264.         may be part of structures. It is legal to write:
  1265.  
  1266.                                     X = a + b
  1267.              
  1268.         which  results in the instantiation of X to the struture (a + b). 
  1269.         But the following is not legal:
  1270.  
  1271.                        alpha( X, Y ) :- X + Y, beta( Y ).
  1272.  
  1273.  
  1274.         Evaluation  of  an arithemtic expression is mediated by the  "is" 
  1275.         and inequality predicates.  For instance,  the following would be 
  1276.         correct:
  1277.  
  1278.                          alpha( X, Y, Z ) :- Z is X + Y.
  1279.  
  1280.                          beta( X, Y ) :- X + 2 < Y + 3.
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.                              Conserving memory space
  1323.  
  1324.  
  1325.                Success popping is controlled by the predicates "popond",
  1326.         "popoffd",  "popon",  and  "popoff".  Success popping is means of 
  1327.         reclaiming  storage which is used on backtracking to  reconstruct 
  1328.         how a particular goal was satisfied.  If it is obvious that there 
  1329.         is no alternative solution to a goal this PROLOG system is  smart 
  1330.         enough to reclaim that storage. 
  1331.  
  1332.              In  this system,  succees popping is an expensive operation. 
  1333.         Therefore,  there  is a tradeoff of memory versus  time.  On  the 
  1334.         other hand, discrete use of success popping can actually speed up 
  1335.         a program by recreating structures in a more accessible form.
  1336.  
  1337.              The  definitions of the control predicates is given in  this 
  1338.         manual  and  their use is totally  optional.  The  modulation  of 
  1339.         success popping has no effect on program logic (read solution.)
  1340.              
  1341.              The  "cut"  can  save  substantial  time  and  computational 
  1342.         overhead  as well as storage.  Although the execution of the  cut 
  1343.         costs  time,  you can design your program to use cuts in critical 
  1344.         places  to  avoid unnecessary backtracking.  Thus  the  execution 
  1345.         speed of the program can actually increase. 
  1346.              
  1347.              Anyone  who  has  read Clocksin and  Mellish  is  aware,  of 
  1348.         course, that the "cut" has a powerful logical impact which is not 
  1349.         always desirable.
  1350.  
  1351.  
  1352.         popoff 
  1353.  
  1354.         See the below definition.
  1355.  
  1356.  
  1357.  
  1358.         popon
  1359.  
  1360.         The  inference  engine  does complete success popping  for  goals 
  1361.         which appear after "popon".  Consider this example: 
  1362.  
  1363.           goal :-  a, popon, b, c, popoff, d.
  1364.  
  1365.         If  no alternative solutions exist for b,  then  success  popping 
  1366.         will  reclaim storage by removing unnecessary records  describing 
  1367.         how  "b"  was  satisfied.  If the Prolog system cannot  rule  out 
  1368.         possible additional solutions,  success popping will never occur, 
  1369.         regardless of your use of "popon". 
  1370.              Since goal "d" occurs after "popoff",  success popping  will 
  1371.         never occur.
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.         popoffd
  1389.  
  1390.         If  no  "popon" or "popoff" declarations occur in a  clause,  the 
  1391.         default  action  is  determined by  "popoffd"  and  "popond".  If 
  1392.         "popoffd" has been invoked,  the default is that success  popping 
  1393.         will not occur.
  1394.  
  1395.  
  1396.  
  1397.         popond
  1398.  
  1399.         The inverse of "popoffd". Turns on default success popping.
  1400.         printf( <stream>, <term1>,<term2>,... )
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.                                  Prolog Tutorial          
  1455.  
  1456.  
  1457.                                   Introduction
  1458.  
  1459.  
  1460.  
  1461.  
  1462.              Probably  you  have heard of the language PROLOG within  the 
  1463.         last year or so. You probably wondered the following things:
  1464.  
  1465.         1) What does the name stand for? Names of computer languages are 
  1466.         almost always acronyms.
  1467.  
  1468.         2) What is it good for?
  1469.  
  1470.         3) Why now?
  1471.  
  1472.         4) Can I get a copy to play with?
  1473.  
  1474.              Congratulations! You obviously know the answer to the fourth 
  1475.         question. We now respond to the other three.
  1476.              
  1477.         1)  The  name  stands for "programming in logic." This  we  shall 
  1478.         elaborate on in depth later on.
  1479.  
  1480.         2) PROLOG is good for writing question answering systems.  It  is 
  1481.         also   good   for  writing  programs  that  perform   complicated 
  1482.         strategies  that  compute the best or worst way to  accomplish  a 
  1483.         task, or avoid an undesirable result.
  1484.  
  1485.         3) PROLOG was virtually unknown in this country until researchers 
  1486.         in  Japan announced that it was to be the core language  of  that 
  1487.         country's fifth generation computer project.  This is the project 
  1488.         with  which  Japan hopes to achieve a domainant position  in  the 
  1489.         world information industry of the 1990's. 
  1490.  
  1491.              PROLOG  is  one of the most unusual computer languages  ever 
  1492.         invented.  It  cannot be compared to  FORTRAN,  PASCAL,  "C",  or 
  1493.         BASIC.  The facilities complement,  rather than replace those  of 
  1494.         conventional  languages.  Although  it  has great  potential  for 
  1495.         database  work,  it  has  nothing in  common  with  the  database 
  1496.         languages used on microcomputers.
  1497.  
  1498.              Perhaps  the  best point to make is that while  conventional 
  1499.         languages are prescriptive, PROLOG is descriptive. A statement in 
  1500.         a conventional language might read:
  1501.  
  1502.              if( car_wheels = TRUE ) then
  1503.                begin
  1504.                  (some sort of procedure)
  1505.                  X = X + 1;
  1506.                end 
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.         A statment in PROLOG could just be a statment of fact about  cars 
  1521.         and wheels. There are many relationships that hold. For instance,
  1522.  
  1523.              has( car, wheels ).
  1524.  
  1525.              has( car, quant(wheels, four) ).
  1526.  
  1527.              round( wheels ).
  1528.  
  1529.         Each  of  these statments is an independent fact  relating  cars, 
  1530.         wheels,  and  the  characteristics of wheels.  Because  they  are 
  1531.         independent, they can be put into a PROLOG program by programmers 
  1532.         working separately. The man who is a specialist on car bodies can 
  1533.         say  his thing,  the wheel specialist can have his say,  and  the 
  1534.         participants can work with relative independence. And this brings 
  1535.         to light a major advantage of PROLOG:
  1536.  
  1537.  
  1538.                              PARALLEL PROGRAMMING!!!
  1539.                             
  1540.  
  1541.         With  conventional  programming languages projects can  still  be 
  1542.         "chunked",  or  divided between programmers.  But efficiency on a 
  1543.         team  project  drops  drastically below that  of  the  individual 
  1544.         programmer  wrapped  up  in  his own trance.  As  the  number  of 
  1545.         participants    grows   the   need   for   communication    grows 
  1546.         geometrically. The time spent communicating can exceed that spent 
  1547.         programming! 
  1548.              Although   PROLOG   does   not  eliminate   the   need   for 
  1549.         task  coordination,  the problem is considerably  simplified.  It 
  1550.         also provides the ability to answer questions in a "ready to  eat 
  1551.         form."  Consider your favorite BASIC interpreter.  Based upon the 
  1552.         statements about cars and wheels previously given,  could you ask 
  1553.         it the following question?   
  1554.  
  1555.                        
  1556.               has( car, X ), round( X ).
  1557.  
  1558.              Does  a  car  have anything which  is  round?  The  question 
  1559.         instructs the PROLOG interpreter to consider all the objects that 
  1560.         it  knows are possessed by a car and find those which are  round. 
  1561.         Perhaps  you are beginning to guess that PROLOG has the abilities 
  1562.         of a smart database searcher.  It can not only find the facts but 
  1563.         selectively find them and interpret them.
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.              Consider the problem of a fault tree, as exemplified by this 
  1587.         abbreviated one:
  1588.  
  1589.  
  1590.  
  1591.         {Car won't start}
  1592.              | 
  1593.              | 
  1594.         [Engine  turns  over](No) --> [Battery voltage](no)-\
  1595.                 (Yes)                                       v
  1596.                  |                                  {Check battery}
  1597.                  |
  1598.         [Smell gasoline](yes) --> {Try full throttle cranking}
  1599.                  |                       (failure)
  1600.         /--------/                           |
  1601.  
  1602.                             (details omitted)
  1603.  
  1604.  
  1605.  
  1606.              The fault tree is easily programmed in BASIC. Later we shall 
  1607.         show  that  PROLOG supplies a superior replacement for the  fault 
  1608.         tree.  Though the tree is capable of diagnosing only the  problem 
  1609.         for  which  it was designed,  PROLOG dynamically  constructs  the 
  1610.         appropriate  tree from facts and rules you have provided.  PROLOG 
  1611.         is not limited to answering one specific question.  Given  enough 
  1612.         information,  it  will attempt to find all deductive solutions to 
  1613.         any problem.
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.                                   PROLOG PRIMER
  1654.  
  1655.         I.                       Rules and Facts     
  1656.  
  1657.  
  1658.  
  1659.              This  is  where you should start if you know  nothing  about 
  1660.         PROLOG. Let us consider a simple statment in PROLOG, such as:
  1661.  
  1662.         1)   has( car, wheels ).
  1663.  
  1664.         This  statement  is a "fact.  The word "has" in this statment  is 
  1665.         known  either  as a functor or predicate.  It is a name  for  the 
  1666.         relationship  within the parenthesis.  It implies that a car  has 
  1667.         wheels.  But  the  order  of  the words  inside  the  bracket  is 
  1668.         arbitrary and established by you. You could just as easily say:
  1669.  
  1670.         2)   has( wheels, car ).
  1671.  
  1672.         and if you wrote this way consistently,  all would be  well.  The 
  1673.         words  has,  wheels,  and car are all PROLOG atoms.  "Wheels" and 
  1674.         "car" are constants. 
  1675.              
  1676.         A   database   of  facts  can  illustrate  the   data   retrieval 
  1677.         capabilities of PROLOG. For instance:
  1678.  
  1679.         3)   has( car, wheels ).
  1680.              has( car, frame ).
  1681.              has( car, windshield ).
  1682.              has( car, engine ).
  1683.  
  1684.         You could then ask PROLOG the question:
  1685.  
  1686.         4)   has( car, Part ).
  1687.  
  1688.         The  capital  "P" of Part means that Part is a  variable.  PROLOG 
  1689.         will make Part equal to whatever constant is required to make the 
  1690.         question match one of the facts in the database. Thus PROLOG will 
  1691.         respond:
  1692.  
  1693.              Part = wheels.
  1694.              
  1695.              More?(Y/N):
  1696.  
  1697.         If you type "y" the next answer will appear:
  1698.  
  1699.              Part = frame.
  1700.  
  1701.              More?(Y/N):
  1702.  
  1703.         If you continue, PROLOG will produce the answers Part = windshield 
  1704.         and Part = engine. Finally, you will see:
  1705.  
  1706.              More?(Y/N):y
  1707.  
  1708.              No.
  1709.          
  1710.         indicating that PROLOG has exhausted the database.  Incidentally, 
  1711.         when  a  variable is set equal to a constant or  other  variable, 
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.         it is said to be instantiated to that object.
  1719.  
  1720.              Notice  that  PROLOG searches the database forwards  and  in 
  1721.         this case,  from the beginning.  The forward search path is built 
  1722.         into PROLOG and cannot be changed. An author of a program written 
  1723.         in  a  prescriptive language is quite conscious of the  order  of 
  1724.         execution  of  his program,  while in PROLOG it is  not  directly 
  1725.         under his control.
  1726.              
  1727.              The other major element is the rule which is a fact which is 
  1728.         conditionally true. In logic this is called a Horn clause: 
  1729.  
  1730.  
  1731.         5)   has( X, wheels ) :- iscar( X ).
  1732.  
  1733.         The  fact iscar( car ) and the above rule are equivalent to
  1734.  
  1735.         6)   has( car, wheels).
  1736.  
  1737.         The  symbol :- is the "rule sign." The expression on the left  of 
  1738.         :-is the "head" and on the right is the body.  The variable X has 
  1739.         scope  of the rule,  which means that it has meaning only  within 
  1740.         the rule.  For instance,  we could have two rules in the database 
  1741.         using identically named variables.
  1742.  
  1743.  
  1744.         7)   has( X,  transportation ) :- 
  1745.                            has( X,  car ), has( license, X ).
  1746.  
  1747.         8)   has( X, elephant ) :- istrainer( X ), hasjob( X ).
  1748.  
  1749.         The  variables  X in the two expressions are completely  distinct 
  1750.         and have nothing to do with each other.
  1751.  
  1752.         The comma between has( X, car ) and has( license, X ) means "and" 
  1753.         or logical conjuction.  The rule will not be true unless both the 
  1754.         clauses has(X, car) and has( license, X ) are true.
  1755.  
  1756.  
  1757.              On the other hand if there is a rule
  1758.              
  1759.         9)   has( license, X ) :- passedexam( X ).
  1760.  
  1761.         consider what PROLOG will do in response to the question:
  1762.  
  1763.         10)  has( harry, transportation ).
  1764.  
  1765.         (Notice  that  harry has not been capitalized because we  do  not 
  1766.         want  it  taken as a variable.  We could,  however,  say  'Harry' 
  1767.         enclosed in single quotes.)
  1768.  
  1769.              It  will scan the database and use (7),  in which X will  be 
  1770.         instantiated to harry. The rule generates two new questions:
  1771.  
  1772.         11)  has( harry, car ).
  1773.  
  1774.         12)  has( license, harry ).
  1775.  
  1776.         Assuming  that  harry  has  a car,  the first clause  of  (7)  is 
  1777.         satisfied and the database is scanned for a match to (12). PROLOG 
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.         picks  up  rule (9) in which X is instantiated to harry  and  the 
  1785.         question is now posed:
  1786.  
  1787.         13)  passedexam( harry ).
  1788.  
  1789.              If there is a fact:
  1790.  
  1791.              passedexam( harry ).
  1792.  
  1793.         in  the database then all is well and harry  has  transportation. 
  1794.         If there is not, then PROLOG will succinctly tell you:
  1795.  
  1796.              No.
  1797.  
  1798.         But  suppose Harry has money and can hire a chauffer as any  good 
  1799.         programmer  can.  That  could be made part of the program in  the 
  1800.         following way.
  1801.  
  1802.              The rule which PROLOG tried to use was:
  1803.  
  1804.         14)  has( X,  transportation ) :- 
  1805.                            has( X,  car ), has( license, X ).
  1806.  
  1807.         At any point following it there could be included another rule:
  1808.  
  1809.         15)  has( X, transportation ) :- has( X, money ).
  1810.  
  1811.         or simply the bald fact:
  1812.  
  1813.         16)  has( harry, transportation ).
  1814.  
  1815.              These  additional  rules  or  facts would  be  used  in  two 
  1816.         circumstances.  If at any point a rule does not yield a solution, 
  1817.         PROLOG   will  scan  forward  from  that  rule  to  find  another 
  1818.         applicable  one.  This process is known as "backtracking  search" 
  1819.         and can be quite time consuming.
  1820.  
  1821.  
  1822.         If  in response to the "More?" prompt you answer "y" PROLOG  will 
  1823.         search  for an additional distinct solution.  It will attempt  to 
  1824.         find an alternate rule or fact for the last rule or fact used. If 
  1825.         that  fails,  it  will back up to the antecedent rule and try  to 
  1826.         find  an alternate antecedent.  And it will continue to  back  up 
  1827.         until  it  arrives at the question you asked,  at which point  it 
  1828.         will say:
  1829.  
  1830.              No.
  1831.  
  1832.         "Antecedent"  to a rule means that it gave rise to its' use.  For 
  1833.         example,  (7)  is  the antecedent of (9) in the  context  of  the 
  1834.         question (16).
  1835.  
  1836.  
  1837.  
  1838.  
  1839.         II.                          Grammar
  1840.  
  1841.              It is a boring subject, but it must be discussed. All PROLOG 
  1842.         statements are composed of valid terms, possibly a rule sign (":-
  1843.         "),  commas representing conjunction ("and"), and a period at the 
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.         very end.
  1851.              A term is a structure, constant, variable, or number.
  1852.          
  1853.              What is a structure? It is a kind of grouping:
  1854.  
  1855.              1) Structures consist of a functor, and a set of objects or
  1856.                 structures in parenthesis.
  1857.  
  1858.              2)  Objects are constants,  variables,  numbers,  or  lists, 
  1859.                 which we have not discussed yet.
  1860.  
  1861.              3)  A  constant or functor must be a string of  letters  and 
  1862.                 numbers, beginning with a lower case letter, unless
  1863.                 you  choose  to  enclose  it in single  quotes  (  'howdy 
  1864.                 pardner'  ),  in  which  case you are  freed  from  these 
  1865.                 restrictions.
  1866.              4) A  variable  must be a string of  letters  and  numbers 
  1867.                 beginning with a capital letter.
  1868.              
  1869.              5) A  functor  may optionally have  arguments  enclosed  in 
  1870.                 parenthesis , as in: hascar( X ) or hascar. 
  1871.  
  1872.         An example:  "has( X, transportation )." is a structure.
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.         III.                     Input / Output      
  1917.  
  1918.              You   now   know  enough  to  write  simple  databases   and 
  1919.         interrogate   them  profitably.   But  before  we  examine   more 
  1920.         sophisticated  examples,  it  will be necessary to add input  and 
  1921.         output to the language. There are built in functions which appear 
  1922.         as rules which are satisfied once. Thus the statment:
  1923.  
  1924.              write( 'Hello world.' ).
  1925.  
  1926.         can be included on the right side of a rule:
  1927.  
  1928.  
  1929.         greetings(  X ) :- ishuman( X ),  write( 'Hello world.' ).  You 
  1930.         can  also write "write( X )" where X is some variable.  Note that 
  1931.         'Hello  world.' is not enclosed in double quotes.  Single quotes, 
  1932.         which denote a constant, are required. Double quotes would denote 
  1933.         a list, which is another thing entirely.
  1934.  
  1935.         Provided  that  a match to "ishuman" can be  found,  the  builtin 
  1936.         function  "write"  is  executed and the message  printed  to  the 
  1937.         screen.
  1938.              The  builtin  read( X ) reads a "structure" that  you  input 
  1939.         from the keyboard. More formally, we have
  1940.  
  1941.              read( <variable> or <constant> )
  1942.              write( <variable> or <constant> )
  1943.  
  1944.         If you write read( Input ),  then the variable "keyboard" will be 
  1945.         assigned to whatever is typed at the keyboard,  provided that the 
  1946.         input  is a valid PROLOG structure.  The builtin "read" will fail 
  1947.         if instead of Keyboard we wrote read( baloney ),  where "baloney" 
  1948.         is a constant,  and the user at the keyboard did not type exactly 
  1949.         "baloney." 
  1950.  
  1951.         When you input a structure in response to a "read" statement,  be 
  1952.         sure to end it with a period and an <ENTER>. 
  1953.  
  1954.              There  is  a convenient way of putting the cursor on  a  new 
  1955.         line. This is the builtin "nl". For example:
  1956.  
  1957.              showme :- write( 'line 1' ), nl, write( 'line 2' ). 
  1958.  
  1959.         would result in:
  1960.  
  1961.              line 1
  1962.              line 2
  1963.  
  1964.              There  is  also a primitive form of input/output for  single 
  1965.         characters. It will be discussed later.
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.         IV.                   A Fault Tree Example
  1983.  
  1984.              Consider the "won't start" fault tree for an automobile:
  1985.  
  1986.         {Car won't start}
  1987.              | 
  1988.              | 
  1989.         [Engine  turns  over](No) --> [Battery voltage](no)-\
  1990.                 (Yes)                                       v
  1991.                  |                                  {Check battery}
  1992.                  |
  1993.         [Smell gasoline](yes) --> {Try full throttle cranking}
  1994.                  |                       (failure)
  1995.         /--------/                           |
  1996.         |           /------------------------/ 
  1997.         |           |                       
  1998.         |           |
  1999.         |  [Check for fuel line leaks](yes)-->{Replace fuel line}
  2000.         |          (no)
  2001.         |           |
  2002.         |           |
  2003.         |  [Check for defective carburator](yes)--\
  2004.         |          (no)                           v
  2005.         |                                {Repair carburator}
  2006.         \----\
  2007.              |
  2008.              |
  2009.         [Is spark present](no)-->[Do points open and close](no)-\
  2010.              |                             (yes)                v
  2011.         /----/                               |          {Adjust points}
  2012.         |           /------------------------/
  2013.         |           |
  2014.         |  [Pull distributor wire, observe spark](blue)--\
  2015.         |        (orange)                                v
  2016.         |           |                           {Check plug wires & cap}
  2017.         |           |
  2018.         |  [Measure voltage on coil primary](not 12V)--\
  2019.         |         (12V)                                v
  2020.         |           |              {Check wiring, ballast resistor}
  2021.         |           |
  2022.         |  [Check condenser with ohmmeter](conducts)--\
  2023.         |    (no conduction)                          v
  2024.         |           |                         {Replace condenser}
  2025.         |           |
  2026.         |  [Open and close points](voltage not 0 - 12)--\
  2027.         |   (voltage swings 0 - 12)                     v
  2028.         |           |                         {Fix primary circuit}
  2029.         |           |
  2030.         |  {Consider hidden fault, swap components]
  2031.         |
  2032.         |
  2033.         \-------{Call a tow truck!!}
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.              A PROLOG program to  implement this is simple. Each statment 
  2049.         represents  a  decision point fragment of the  tree.  The  PROLOG 
  2050.         interpreter  dynamically  assembles  the tree as  it  attempts  a 
  2051.         solution. 
  2052.  
  2053.         'car wont start' :- write( 'Is the battery voltage low?' ), 
  2054.                             affirm, nl,
  2055.                             write( 'Check battery' ).
  2056.  
  2057.         'car wont start' :- write( 'Smell gasoline?' ), 
  2058.                             affirm, nl,
  2059.                             'fuel system'.
  2060.  
  2061.         'fuel system'    :- write( 'Try full throttle cranking' ).
  2062.  
  2063.         'fuel system'    :- write( 'Are there fuel line leaks?' ),
  2064.                             affirm, nl,
  2065.                             write( 'Replace fuel line.' ).
  2066.  
  2067.         'fuel system'    :- write( 'Check carburator' ).
  2068.  
  2069.         'car wont start' :- write( 'Is spark present?' ),
  2070.                             not( affirm ), nl,
  2071.                             'no spark'.
  2072.  
  2073.         'no spark'       :- write( 'Do points open and close?' ),
  2074.                             not( affirm ), nl,
  2075.                             write( 'Adjust or replace points.' ).
  2076.  
  2077.         'no spark'       :- write( 'Is the spark off the coil good?' ),
  2078.                             affirm,
  2079.                             write( 'Check plug wires and cap.' ).
  2080.  
  2081.         'no spark'       :- write( 'What is the voltage on the primary
  2082.                              of the coil: ' ), 
  2083.                             read( Volts ), 
  2084.                             Volts < 10,
  2085.                             nl,
  2086.                             write('Check wiring and ballast resistor.').
  2087.  
  2088.         'no spark'       :- write( 'Does the capacitor leak?' ),
  2089.                             affirm,
  2090.                             write( 'Replace the capacitor.' ).
  2091.  
  2092.         'no spark'       :- not( 'primary circuit' ).
  2093.  
  2094.         'primary circuit' 
  2095.                          :- write( 'Open the  points.  Voltage  across 
  2096.                               coil?:'), nl,
  2097.                             read( Openvolts ), Openvolts < 1, 
  2098.                             write(  'Close the points.  Voltage  across 
  2099.                               coil?:'),
  2100.                             read( Closevolts ), Closevolts > 10, nl,
  2101.                             write( 'Primary circuit is OK.' ). 
  2102.  
  2103.         'no spark'       :- write( 'Consider a hidden fault. Swap
  2104.                               cap, rotor,points,capacitor.' ).
  2105.  
  2106.  
  2107.         'Car wont start' :- write( 'Get a tow truck!!' ).
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.                                  --End program--
  2117.  
  2118.  
  2119.              The  above  is  a  simple example of  an  expert  system.  A 
  2120.         sophisticated  system would tell you exactly the method by  which 
  2121.         it  has reached a conclusion.  It would communicate by a  "shell" 
  2122.         program  written  in PROLOG which would accept a wider  range  of 
  2123.         input   than  the  "valid  structure"  required  by  the   PROLOG 
  2124.         interpreter directly.
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.         V.                            Lists               
  2181.  
  2182.              Consider  a  shopping list given you by your wife.  It is  a 
  2183.         piece of paper with items written on it in an order that probably 
  2184.         symbolizes  their  importance.  At the top it  may  say  EGGS!!!, 
  2185.         followed by carrots, hamburger, and finally a flea collar for the 
  2186.         dog, if you can find one. In PROLOG such a list would be written:
  2187.  
  2188.         1)   [eggs, carrots, hamburger, fleacollar]
  2189.  
  2190.         The  order of a list is important so that eggs and carrots cannot 
  2191.         be reversed and PROLOG be uncaring.
  2192.  
  2193.         Let us put the list in a structure:
  2194.  
  2195.              shopping( [eggs, carrots, hamburger, fleacollar] ).
  2196.  
  2197.         Then  if you wished to isolate the head of the list you could ask 
  2198.         the question:
  2199.  
  2200.              shopping( [ Mostimportant | Rest ] ).
  2201.  
  2202.         and PROLOG would respond:
  2203.  
  2204.              Mostimportant   =  eggs,   
  2205.              Rest   =   [carrots,   hamburger, fleacollar].
  2206.  
  2207.         The vertical bar "|" is crucial here. It is the string extraction 
  2208.         operator,  which  performs  a  combination  of the  CDR  and  CAR 
  2209.         functions  of LISP.  When it appears in the context [X|Y] it  can 
  2210.         separate the head of the list from the rest, or tail.
  2211.  
  2212.  
  2213.              You  may have gained the impression that PROLOG is a  rather 
  2214.         static language capable of answering simple questions,  but it is 
  2215.         far  more powerful than that.  The string extraction operator  is 
  2216.         the  key.  It permits PROLOG to whittle a complex expression down 
  2217.         to the bare remainder.  If the rules you have given it permit  it 
  2218.         to  whittle  the  remainder  down to  nothing,  then  success  is 
  2219.         achieved. An example of this is the definition of "append."
  2220.  
  2221.              Let  us suppose you have not yet done yesterday's  shopping, 
  2222.         let alone today's. You pull it out of your wallet and sootch tape 
  2223.         it to the list your wife just gave you. Yesterday's list was:
  2224.  
  2225.              [tomatoes, onions, ketchup]
  2226.  
  2227.         Combined with [eggs, carrots, hamburger, fleacollar] we obtain
  2228.  
  2229.              [eggs,carrots,hamburger,fleacollar,tomatoes,onions,garlic].
  2230.  
  2231.         To  take one list and to attach it to the tail of another list is 
  2232.         to  "append"  the first to the second.  The PROLOG definition  of 
  2233.         append is:
  2234.  
  2235.  
  2236.  
  2237.         Rule1:     append( [], L, L ).
  2238.  
  2239.         Rule2:     append( [X|List1], List2, [X|List3] ) :-
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.                       append( List1, List2, List3 ].
  2247.  
  2248.         The  general  scheme is this:  
  2249.  
  2250.         The definition consists of one rule and one fact.  The rule  will 
  2251.         be used over and over again until what little is left matches the 
  2252.         fact.  The [] stands for empty list,  which is like a bag without 
  2253.         anything in it. This is an example of a recursive definition.
  2254.              Suppose we ask:
  2255.  
  2256.              append( [a,b,c], [d,e,f], Whatgives ).
  2257.  
  2258.         1. Rule 2 is invoked with arguments ( [a,b,c], [d,e,f], Whatgives ).
  2259.         2. Rule 2 is invoked again with arguments:
  2260.              ( [b,c], [d,e,f], List3 ).
  2261.         3. Rule 2 is invoked again with arguments:
  2262.              ( [b], [d,e,f], List3 ).
  2263.         4.  The  arguments  are now ([],  [d,e,f],  List3 ).  Rule 1  now 
  2264.             matches. End.
  2265.  
  2266.         How does this cause a list to be constructed? The key is to watch 
  2267.         the   third  argument.   Supplied  by  the  user,   it  is  named 
  2268.         "Whatgives". The inference engine matches it to [X|List3] in rule 
  2269.         2. Now lets trace this as rule two is successivly invoked: 
  2270.  
  2271.  
  2272.                 Whatgives                                                
  2273.                    |                                                     
  2274.                    |                                                     
  2275.                    |                                                     
  2276.                    v                                                     
  2277.         Rule2:  [X|List3] (List3 = [b,c])                                
  2278.                  |  \                                                    
  2279.                  |   \                                                   
  2280.                  |    \                                                  
  2281.                  v     \                                                 
  2282.         Rule2:   a   [X'|List3'] (List3' = [c])                          
  2283.                       |    \                                             
  2284.                       |     \                                            
  2285.                       |      \                                           
  2286.                       v       \                                          
  2287.         Rule2:        b     [X''|List3''] (List3'' = [], ie., empty set.)
  2288.                               |    \                                     
  2289.                               |     \                                    
  2290.                               |      \                                   
  2291.         Rule1:                c       L  ( in Rule1 = [d,e,f] )              
  2292.                                                                          
  2293.         End.
  2294.  
  2295.  
  2296.         L in rule 1 is [d,e,f] for the following reason: Notice that rule 
  2297.         2 never alters List2. It supplies it to whatever rule it invokes. 
  2298.         So L in rule 1 is the original List2, or [a,b,c].
  2299.  
  2300.              This example would not have worked if the order of rules one 
  2301.         and  two  were  reversed.  The  PROLOG  inference  engine  always 
  2302.         attempts to use the the first rule encountered. You could imagine 
  2303.         it as always reading your program from the top down in attempting 
  2304.         to  find an appropriate rule.  Since rule 2 would always satisfy, 
  2305.         an  unpleasant  thing  would  have happened  if  the  order  were 
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.         reversed. The program would loop forever.
  2313.              
  2314.  
  2315.  
  2316.  
  2317.              I  hope  that  this tiny introduction to PROLOG  whets  your 
  2318.         appetite. You should now purchase the book
  2319.  
  2320.              Programming In Prolog
  2321.              W.F. Clocksin and C.S. Mellish
  2322.              Springer - Verlag
  2323.              Berlin,Heidelberg,New York. 1981,1984
  2324.  
  2325.  
  2326.  
  2327.  
  2328.  
  2329.  
  2330.  
  2331.  
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.